package com.zy.di.pro2_autowired_annotation;

import org.springframework.stereotype.Service;

import javax.inject.Inject;
import javax.inject.Named;

@Service
public class OrderBizImpl implements OrderBiz{
    //@Qualifier("orderOceanDao")
   // @Autowired   //按照类型注入
    //private OrderDao orderDao;


    //方案二:
    //@Resource(name="orderOceanDao")
    //private OrderDao orderDao;

    //方案三:
    //@Resource   // 按照类型注入，如果有多个类型，按照名称注入,也可以@Resource(name="orderOceanDao")指定名称
    //private OrderDao orderDao;

    //方案四
    @Inject
    @Named("orderOceanDao")
    private OrderDao orderDao;


    @Override
    public void makeOrder() {
        if(orderDao!=null){
            orderDao.addOrder();
        }

    }
}
